using System; 
using System.Threading; 
using System.Workflow.Activities; 
using System.Workflow.Runtime; 
 
namespace FooBar 
{
   class Hello 
   { 
      public static void Main()
      {
         using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) 
         {
            AutoResetEvent waitHandle = new AutoResetEvent(false);
 
            workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) 
            { 
               waitHandle.Set();
            }; 
 
            WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(FooBar.Demo)); 
            instance.Start(); 
            waitHandle.WaitOne(); 
         }
      }
   }
   partial class Demo
   {
	 	int TempNatal = 0;
	 	int TempJoao = 0;
		buscarTemperaturaClass buscarTemperatura= new buscarTemperaturaClass(); 
		tweetClass tweet= new tweetClass(); 
		initVarClass initVar= new initVarClass(); 
		storeClass store= new storeClass(); 
		loadClass load= new loadClass(); 

 
		private void pegarTemp0_ExecuteCode(object sender, EventArgs e) { 
			TempNatal = buscarTemperatura.buscarTemperatura("Natal");
			Console.WriteLine(TempNatal); 
 		} 
		private void pegarTemp1_ExecuteCode(object sender, EventArgs e) { 
			TempJoao = buscarTemperatura.buscarTemperatura("Joao Pessoa");
			Console.WriteLine(TempJoao); 
 		} 
		private void tuitar2_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("Temperatura em Natal > Temperatura em Joao Pessoa"); 
		}
		private void tuitar3_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("Temperatura em Natal < Temperatura em Joao Pessoa"); 
		}
		private void tuitar4_ExecuteCode(object sender, EventArgs e) { 
			tweet.tweet("Temperatura em Natal = Temperatura em Joao Pessoa"); 
		}
		private void IfElseCondition0_ExecuteCode(object sender, ConditionalEventArgs e) 
 		{ 
 			if (TempNatal > TempJoao) 
				e.Result = true; 
			else 
				e.Result = false; 
		}
		private void IfElseCondition1_ExecuteCode(object sender, ConditionalEventArgs e) 
 		{ 
 			if (TempNatal < TempJoao) 
				e.Result = true; 
			else 
				e.Result = false; 
		}
		private void IfElseCondition2_ExecuteCode(object sender, ConditionalEventArgs e) 
 		{ 
 			if (TempNatal == TempJoao) 
				e.Result = true; 
			else 
				e.Result = false; 
		}
		private void WhileActivity0_CodeCondition(object sender, ConditionalEventArgs e)
		{
			if (10 == 10)
				e.Result = true;
			else 
			{
				e.Result = false; 
				Console.Read();
			}
		}

		private void finalizar_ExecuteCode(object sender, EventArgs e) { 
			Console.WriteLine("Tecle Enter para sair: "); 
  			Console.ReadLine();
		}
	}
}